<template>
  <div class="app">
    <h1>我是App组件</h1>
    <suspense>
      <template v-slot:default>
        <Child></Child>
      </template>
      <template v-slot:fallback>
        <h3>稍等，加载中...</h3>
      </template>
    </suspense>
  </div>
</template>

<script>
// import Child from "@/components/Child";  //静态引入
import {defineAsyncComponent} from 'vue'
const Child=defineAsyncComponent(()=>import('@/components/Child'))  //异步引入
export default {
  name: 'App',
  components: {Child},
}
</script>

<style scoped>
.app{
  background-color: gray;
  padding: 10px;
}
</style>
